Category Archives: Programming

Proper case a string using RegEx in Javascript, except for words in parenthesis

Today I had to find a way to proper case a string, except anything that is in parenthesis.  That sounds like a mouthful, so to clarify, I wanted to turn “JAVASCRIPT ROCKS (JS)” into “Javascript Rocks (JS)”, so I created a regular expression to do this task in an Adobe LiveCycle form.

I learned that this uses a negative lookahead that looks for things in parenthesis, and if it is in parenthesis, it does not match the next part, which is looking for words followed by white space.

Have fun using negative lookaheads in RegEx.  This doesn’t have to only be done in Javascript, but can be done in most any language.

Must have applications for development

I recently had to re-install ALL of the applications that I use at work when they gave me a new Windows 7 based computer, so I thought I would list out the apps that I HAVE to have to operate.

These are listed in no particular order:

  • Microsoft SQL Server 2014 Express
  • Visual Studio 2012 – Didn’t really want to, but I had to for SSIS packages at work.
  • Visual Studio 2013
  • Microsoft SQL Data Tools
  • Visual Studio Power Tools – Lots of helpful tools.
  • Jetbrains Resharper Ultimate– A GREAT suite of tools for developers.  I am so thankful that my work provides this for us.
  • Scooter Software’s Beyond Compare (V3)
  • Linqpad Pro
  • WinSCP for terminal sessions into a UNIX box
    Oracle Client
  • LastPass – For password management!
    TreeSize Pro – For space management, not as necessary on this machine because I have more space, but … it might be a good idea for me to keep it clean.  🙂
  • Snagit – The best screen capture out there.  If you want a free app, I used Greenshot before I got Snagit and it was pretty great also.
  • Notepad++ – a great free editor, but I am now playing with Brackets from Adobe.
  • Dual Monitor Taskbar – This great free app lets me have a task bar on my 2nd monitor.  It has a few bugs in it, but for the most part it is very helpful to have the running apps in a task bar on that 2nd monitor.
  • Microsoft Attunity Drivers for Oracle 2.0 – for those pesky Oracle SSIS projects.
  • SAP Crystal Reports 2013 – I worked with Crystal Reports a LONG time ago and I used to like it very much, but there are so many better options for reports now.  I inherited a old project at work that uses this, so I had to have it, until we can re-write this application.
  • Logi Analytics – This is a charting and dash boarding tool that is pretty cool.  We are doing some pretty complicated things with it at my job.
  • Chrome – My go to browser.  It hosts some great plugins for me such as Feedly, Lastpass, and Advance Rest Client (for developing REST apps, but I see a LOT of people using Postman, so I will try that out next time.)  I also restored my shortcuts that I had backed up before I got my new machine.
    Internet Explorer Shortcuts and Favorites – Restored Short cuts that I had backed up.
  • UC4 – For  scheduling batch and nightly jobs here at work.
  • Ditto – a great free clipboard manager.  Somewhat better than ClipX that I have tried.

If you have seen something new, give them a try.

Adding a solution to TFS without adding the NuGet packages.

I was adding a project that I just completed to TFS source control and noticed that it wanted to add the packages to source control also, but I didn’t want that because you are not supposed to add the NuGet packages.  They can be re-downloaded and installed during the build process for anyone that does not have them.

I found this nuget link extremely useful on how to configure the solution to 1) Enable the nuget download and 2) keep the packages from being added to source control.

The basic steps are:

            1. Enable the NuGet package restore.  This will add some NuGet stuff to the solution.
            2. Add your project to TFS, then of course commit the change.

C# Parallel Tasks gives MAJOR Speed Increase

I just used parallel tasks to decrease the time a process took from over an hour to about 2 minutes.  I was wary of creating so many database contexts, but it paid off in a major way!

See the snippet of code below to see how I used the Parallel.ForEach.  .Net created almost 100 threads during the execution.

Important
If you need someone with my ability to decrease processing times on a full time basis, please contact me through LinkedIn 

Have a great day!

Learning about SOLID programming principles

I have been learning about SOLID programming principles and I wanted to share the resources that I have found.

First, I listed to the father of these principles describe them on the Hansleman show.  This post obviously caused a few ruffled feathers and for fun, you must listen to show #150 to hear some of the aftermath from Uncle Bob.

Then I found a great youtube video of Steve Bohlen from Microsoft show examples in C# on how these principles can be implemented  and what to look for.  

ToQuarter C# DateTime Extension

I searched on the internet for a quick way to get the Quarter from a DateTime, but I didn’t really find anything useful, so I created this quick extension that seems to work great!  I just wanted to share this to save someone time so they don’t waste the same amount of time that I did.  I am thinking about putting together an open source library to handle many other things like this, what are your thoughts about this?

 

 

 

Converting Oracle Comments to SQL Server.

I downloaded some code a recently that creates an Oracle Database, but I don’t have Oracle, so I converted most of the code to SQL Server.  One of the harder things to convert was the column and table comments.  One of the features of Oracle that Microsoft SQL Server does not have directly is commenting. It appears that you can have comments on a table and comments on a column (field) in the table.

Well after doing some research into how to convert these to SQL Server,  I came across an article at http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=37796 that told how to do this.  Well, I had a script with over 1,100 comments, so I used LinqPad to create a small program that would convert my script using Regular Expressions.

Here is the code for that, please let me know if this helps anyone.  It sure made my work a lot easier.

This is for Table Comments:

And here is the code for Column comments.