Friday, September 05, 2014

Regular Expressions in SQL Server, DB2 UDB, and Oracle

I was a bit surprised that not all RDBMS platforms offer robust, native support for regular expressions.

Oracle:

Oracle introduced this in 10g. It is implemented in roughly the way I would expect and looks like it's pretty useful.
Reference

DB2:

DB2 seems to have this capability in 9.7. NOTE that I have not checked to see if it was available in earlier releases.  However, it appears you have to go through the XQuery interface. I'm not surprised by this, but a bit disappointed.  I had hoped for an implementation more like Oracle's. I think that the DB2 way is going to be cumbersome for the average user.

Example:
db2 "with val as (
 select t.text
 from texts t
 where xmlcast(xmlquery('fn:matches(\$TEXT,''^[A-Za-z 0-9]*$'')') as integer) = 0
)
select * from val"

Reference1, IBM DB2 for LUW 9.7 information center reference

MS SQL Server: 

SQL Server, it seems, requires you to roll your own solution or look to some sort of 3rd party.  I'm very surprised by this.

There are 3rd party libraries that appear to be pretty robust.  One example can be found here: SQL Server Central article on RegEx in MSSQL Server

I suppose that they want us to use the full text search, which appears to have robust features, and address the same purpose.  Still, just a bit surprised ...

Monday, August 25, 2014

Createing a remote UDF for a Federated DB2 LUW 9.5 database

There are a couple good references for federated DB's that I've found in my research, but none really laid out the high level process for connecting a DB2 federated DB to a UDF on a data source.

Here are the steps.

  1. Create Function on Datasource DB
  2. Create Function Template on Federated DB
  3. Create Function Mapping on federated db



For details on how to perform each of these steps, consult

  • The DB2 9.5 Info Center. There's an entire section on Federation that's OK.
  • The Federated Systems Guide. Google it. It's a PDF.


Good luck!

Monday, August 11, 2014

Christianity and Evolution


I don't understand.
I really, really don't understand. Not even a little bit.
OK, several things.

1) An atheist who says "there is no God because science" is just as wrong as a Christian who says "Evolution can't be true because bible." 

2) EVOLUTION does not equal ATHEISM. Lots of people believe in a deity and still buy into evolution.

3) Evolution does not have to mean there is no God. In point of fact, it doesn't have to mean much of anything to a religious or faith perspective.

Well, I guess it does in a very specific situation...

IF you REALLY believe that God LITERALLY spoke things into existence in 7 days, creating a vault in the sky between two waters and hanging in that vault the sun, moon, and stars
.. AND IF you believe that he sort of drew a person in the dirt and blew on him to make him live
... AND IF you believe that an ACTUAL TALKING SNAKE (because, hey, who HASN'T run across one of those ... ) talked an actual woman into eating an ACTUAL piece of fruit that, when eaten, somehow LITERALLY gave here the knowledge of good and evil 
... AND IF you believe that this Omnipotent God that was so powerful he spoke things into existence was just sort of strolling in the garden one day and was, in spite of being all-knowing, completely taken by surprised by this unacceptable state of affairs
... AND IF you believe that, in his goodness and mercy and utter, perfect justness he could think of no other course of action than to curse not only the "guilty" party, but all of their offspring for ever and ever and the entire earth and everything on it, up to and including an eternity in HELL for nothing more egregious than being born human  ...

*deep breath*
Yeah. Maybe it went down EXACTLY that way. Why not ...

Look - if you want all of that to be LITERALLY TRUE, then I guess you can't be OK with evolution.

If you want it to be a beautiful, important, symbolic allegory for something far more profound and important, then there's not a problem, here.

This is all just one more way to practice that basal human impulse to divide into us and them, love us, and hate them, and nobody does it better than Christians...

How's that new nature coming along?

Saturday, July 05, 2014

HOBBY LOBBY, why I care...

Sometimes I find myself very puzzling.

Why, for instance, am I so terribly, terribly upset about the Hobby Lobby thing?

A bunch of very nice folks who, by most accounts, give their employees a great place to work relative to the other outfits in that space, are asking, in their minds, to not pay for murder.
That doesn't seem unreasonable to me.

So why am I so upset?

This probably says it better than I ever could.
http://aattp.org/when-corporations-become-indistinguishable-from-churches-government-isnt-far-behind/

It's a little long winded, and I have a few things to add, so here's a summary followed by some embellishments.

Summary: 
It's one more step towards what the author so rightly points out is a uniquely American form of Oligarchy / Theocracy. Is the Hobby Lobby thing, in itself, a terribly big deal? Probably not. But, as the author points out, the supreme court has instructed lower courts to reexamine several cases related to birth control in light of this ruling. It's part of a larger pattern.  Corporations are people.  Money is speech. If my feudal Lord believes a thing, then by God it impacts me. And, the obvious answer of a single payer system is right out of the question, despite all the problems it would solve.

My first Embellishment -

It's that maddening abortion question that seems to be the end all and be all of every consideration in the conservative religion.

You believe life begins at conception.

OK - Why? There are several key points between conception and birth, actually including birth, that I could make an argument for. Why conception?
And, can you prove it sufficiently to design law around it?

And while I'm asking questions, why do you insist on calling me a murderer if I don't agree that this is where life starts? What great evidence can you site that gives you the right to poke your finger into the chest of my wife or daughter who believes differently than you and say "You have to surrender your body to the rigors and dangers of pregnancy for 9 months AGAINST YOUR WILL because I, THE GOOD AND PERFECT CHRISTIAN, BEELIEEEEVE that the thing in your belly is a person."  I've come to see this whole issue as a power-grab, with you the Moral Majority imposing your will, once again, on people who do not believe as you do, against their will. Until you can prove that the thing in question is, in fact, a person, then MY RELIGIOUS FREEDOMS must be protected. Specifically, my freedom to disagree with your religious assertions.

My second embellishment - Sorry, but just the hypocrisy ...

The inconceivable levels of hypocrisy of the conservative religion.
I've heard them all.  "Come to church, there's always room for one more." "I'm just a sinner saved by grace".  on and on.  You know what, that GREAT, until you start making LAWS.
Two of the most outspokenly anti-gay-marriage people I know are divorced and just got remarried in defiance of he word of CHRIST!!  But YOU, you dirty Ho-Mo-SEXual, with your SATANIC a-GEN-da ... GOD WILL JUDGE 'MERICA if we allow you to jointly file your income taxes.

1/2 of my Pastor's family will be at work on Sunday in DEFIANCE of the very 10 commandments they want posted in every court house.

I could go on and on.  It's like the "biblical" rules are for everyone BUT YOU, the CHRISTIAN who's hitting people over the head with them.

I have more, but this is getting long, so I'll cut to the chase.

My last embellishment - ultimately, there's the Obama factor.

There's a link that the author shared, which I'll not take the time to investigate, because I've done that too many times and no one cares. If you'd like to, feel free.

At any rate, it states that Hobby Lobby was ALREADY paying for these "abortifacients" before it became an Obama issue,  It was paying for them, one would assume, because of a federal mandate that employers provide health insurance to workers that, if I'm not mistaken, dates back to the 70's.

Why, then, the current challenge? That demonic Obama character, that's why.

The Obama presidency has shown me a few things.
1 - The "liberal bias" of the main stream media is nothing at all when compared to the cold as steel effectiveness of the right wing machine.  They've managed to convince their constituency that Obama was born in Kenya, that he's a Muslim, that he is doing horrible things by issuing executive orders, that the vast majority of the solar companies have failed, and on and on and on. Democracy is and will remain completely broken until something is done about that.
2 - I'm not at all sure that we, as a country, would be nearly so susceptible to this if Obama was white.  I know, I know.  You're not a racist.  All I know is that white people have, quite collectively, gone completely off their nut. They will believe almost anything ... no.  They will believe ANYTHING you say about that guy.
3 - NO ONE is better at dividing into us and them, loving us, and hating them, than members of the Conservative Religion, who normally call themselves Christian.  Yes, Christian, I'm talking to you right now.  What makes you so utterly brilliant at it is that you can't possibly imagine that you're doing it.

It's amazing to watch. It really is.


Friday, June 27, 2014

Quit Calling Me Stupid...

I recently saw this one going around Facebook:

Here is my response:

No, I don't think criminals obey laws. Only the fictional liberal bogey man that you create so that you can win arguments believes that. No actual human being believes that.

However, given what I think I know about supply and demand, I DO think it's entirely probable that cutting the overall supply of weapons will reduce the number of criminals who have access to said weapons. Will some criminals still have them? Yes. But, they will have to be smarter and better funded. Will some brainless brat who's going to take your wallet to buy weed have one? Potentially - but it's far less likely, if we sufficiently reduce the supply, thus increasing the value even on a black market. How about the suburban kid who's been rejected by the cute girls one too many times? I dunno. Maybe. But, again, I have to believe a smaller supply is going to create higher barriers to ownership and thus reduce the chances.

This would, of course, require both laws and law enforcement, which I know you hate. I'm not saying it's something conservatives wanna do, just that it could be done.

But, that's not the point. The reality is that NO ONE wants to take your guns away.

Here's what I have a problem with:
In Iowa, Conservatives have gone so stark-raving-mad with hatred for the liberal bogey - man, who I can attest does not exist, that they've passed laws removing Sheriff's discretion from concealed carry permits. The result is convicted sex offenders walking around with concealed carry permits. THAT's the sort of thing that I want to get rid of.

http://archive.desmoinesregister.com/article/20130505/NEWS01/305050072/1001/news/Register-Exclusive-50-sex-offenders-gun-permits

That and gormless twits carrying loaded AR's into Target amongst the sugar-mad kids and terrified soccer moms.
http://www.motherjones.com/politics/2014/06/guns-target-open-carry-texas


The words "well regulated" are right there in the 2nd amendment. Maybe you need to read it again.

And, quit calling me stupid.

Wednesday, February 12, 2014

Well, THIS saved me a lot of hastle

Oracle SQL Developer, rather inexplicably in my view, doesn't come out-of-the-box with a good facility to set the schema.  Even the set active schema command gets ignored.

This extension provides a handy drop-down box that allows you to set the active schema.  Brilliant :-)

http://javaforge.com/project/schemasel

Get Restart log using PowerShell

I'm often curious about a restart on a Windows server system. An easy way to get a list of the restart and what initiated it is to use t...