SQL Server remove leading Zeros (0)

I’ve got a field [OrderID] that’s left zero padded. I want to remove the leading zeros because another data feed stores the order id without the leading zeroes. I need to join tables on these fields. Here’s the select to remove leading zero padding:
SUBSTRING(a.[OrderID], PATINDEX('%[^0]%', a.[OrderID]+'.'), LEN(a.[OrderID]))

If I want to take the non-zero padded value and pad it, I can do this (Assumes the [OrderID] lives at column 94 in the input [DATA] and is up to 5 characters long):
RIGHT('00000' + RTRIM(LTRIM(SUBSTRING([DATA],94,5))),5)

The rest is left to the student. Let’s be careful out there.

Perl IDE v2.0

I probably wrote this up some time ago. Got a new machine at work & need to set it up so thought I’d do a clean slate install.

Make sure you have the latest Java runtime, and for God’s sake keep that pecker-head updated. At the time of this post Java was at 8u60. I believe Eclipse wants at least 7uXX, but I wouldn’t run Java that old if I were you.

You’ll also need DWIMPerl from here. At the time of this writing the release was 5.14.2.1-v7-32. Install taking defaults, in my case it installed in C:\Dwimperl. If you want to upgrade all the modules, invoke the “CPAN client” from the start menu subfolder Tools under DWIM Perl. Enter this command upgrade /(.*)/ and go get several cups of coffee.

Next get eclipse using the installer. I chose the 64b Windows version. Since I program in perl and sometimes in PHP but never in Java, I picked the “Eclipse IDE for PHP Developers”. Once the file has downloaded, check the SHA1 signature with fciv. If it matches what Eclipse says it should be, run the installer package to load Eclipse. I downloaded Mars (4.5). Looks like the developer build is Neon M2. Caveat Emptor. As for me and my house, we’ll stick to Mars.

Now in Eclipse go to “Help”, then “Install New Software…”. Add this url: http://www.epic-ide.org/updates/testing (I wanted the latest and greatest). At this writing, the latest EPIC version was 0.7.x

I also use TortoisSVN (1.9.2)for other development, so I wanted top add Subclipse. In Eclipse go to “Help”, then “Install New Software…” and add this url: http://subclipse.tigris.org/update_1.10.x The link on Tigris.org, then “Download and Install”, calls the latest version 1.12.x, but the link points to 1.10.x. Whatever.

Well DWIM/Strawberry perl is still updating modules. Time for another cuppa Joe.

TortoiseSVN icons on Windows7

I use TortoiseSVN for my version control system, and have run into a situation where the TortoiseSVN icon overlays disappear after another program loads something or updates itself.

Windows doesn’t contain enough settings in the registry and TortoiseSVN’s settings get pushed down the list or overwritten. The SitePoint Blog that covers this is here.

The offending key location is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers.

Dropbox seems to be the culprit in my case. Delete any that you don’t need or want. After a reboot, you should be back in the water.

Windows 10

I received the update the day it became available.  Had it up and running within 4 hours.

Two things to note:

  1. Don’t attempt this unless you’re sure your hard drive is solid.  I ran SpinRite 6.0 on it and got a clean bill of health.  I also ran SeaTools on it since it was a Seagate drive.  Clean report there too.
  2. Read the descriptions CAREFULLY of the options you are asked to set at the end of the install.  Some, OK most, of them will violate your privacy to some degree.  Make sure you’re comfortable with what information you let Microsoft have.

Windows 10 is programmed to share ALL your WiFi passwords in a semi secure way with ALL your social media friends.  Every access point you have connected to.  Yup.  All of them.

Caveat emptor.  But I’m afraid Resistance Is Futile.

Another year gone by…

embarrassing.  Two years.  Two posts. Sheesh.

A lot has been happening in the PLC.  Kids coming home, new ones joining us, changes at work.  Biggest thing at work is getting deeper onto SQL server, and finding more fun things to do with perl.

I’ve been working with healthcare data (HL7 and X12/837/835).  There are a lot of fun things to mine from the X12 data and it’s easy for our clients to pull from the clearinghouse and upload to our Sharefile.

‘Til next year…  Sigh.

1 day short of a year

So the previous post was almost a year ago. I thought I’d knock some rust off this site and pick it up again.

At work, it’s time to upgrade my perl engine. Was thinking I’d switch to OpenBSD, manage the perl packages with pkg_add, and actually have a dev site and a production site.

Then I ran across eclipse, subclipse, Epic and DWIM perl. I was able to identify the modules in use, make sure they were loaded in DWIM, and even incorporate my own perl library.

I’m still trying to sort out the release to production process, but it will likely be a checkout or update from the SVN trunk once I get comfortable with branching and merging.

Instead of managing yet another server and it’s security (or two), I just need to make sure I have the right ODBC driver, DWIM installed, and tortoise SVN with a scheduled task.

What does your perl Devel environment look like?

Rethinking email

Stephanie Vozza wrote an article[1] for Entrepreneur that discussed making email more productive. The point that jumped off the screen for me was:

1. Your email should answer five simple questions.
When you write an email, Kawasaki says it should provide just enough information to answer these five questions: Who are you? What do you want? Why are you asking me? Why should I do what you’re asking? What is the next step?

“This is all an intelligent person needs to know to make a decision,” he says.

One of the comments suggested prefacing your subject line with the word action when you require/desire some action on their part and FYI when you just need to convey some information.

Two final tips I’ve picked up (but have yet to fully implement), [a] calling instead of emailing if the discussion is too complex to fit in 5 sentences and [b] only reading your email at two or three set times of the day.

Links in this post:
[1] http://www.entrepreneur.com/article/226581?sf12589161=1