Pete On Software

RSS Feed

T-SQL TRY_CONVERT()

SQL Server 2012I am a little behind the curve on this one. Starting in SQL Server 2012, Microsoft introduced the TRY_CONVERT() function. This function works the same way as the CONVERT() function, but if the convert doesn’t work, you get NULL instead of an error.

Let’s take a look at the old way:

This returns the message “Conversion failed when converting the varchar value ‘aaa’ to data type int.” If you are doing a CONVERT() on some column in a large dataset, this often can throw you while you try to sort out what went wrong. Enter TRY_CONVERT(). Here is the new syntax:

This just returns NULL and doesn’t error at all. In this case, you can easily provide a default value for the conversion by using ISNULL() or COALESCE()

Pretty darn awesome and about time (well, even four years ago, it was about time!).

Podcast Episode 49 – Obviously

ObviouslyIn this episode, I take a look at one word that you might be using that is making you look like kind of a jerk. Did I just call you a jerk? Maybe a little, but honestly this episode is mostly about how I might have inadvertently been being a jerk for quite some time.

Links Mentioned in this Show:

The O-Word

Simple Programmer YouTube Channel

Listen To This Episode:

You can also subscribe to the podcast at any of these places:
iTunes Link RSS Feed Listen on Stitcher
In addition, my podcast is available on DoubleTwist and the Windows Marketplace.
Thanks to all the people who listen, and a special thanks to those who have rated me. I really appreciate it.

Actionable Books

Actionable Books LogoI know from just about everywhere that people just aren’t that in to reading anymore. Even when people are consuming books, audio books are a growing segment. From recent data that I looked up, the median number of books consumed per year is just 5. Half the people in America consumed less than five books last year. I typically average around a book a week. Are they all code-related? No. They aren’t even all non-fiction. I read quite a bit of fiction as an outlet for my imagination, as I watch less and less TV every year. I know that I’m not typical, so I want to try to be a little pragmatic here.

I came across a site called Actionable Books. This site has a section called “Summaries” where you can read people’s “Actionable Summaries” of books. At the time that I’m writing this, there are summaries for “1005 Top Business Books”. The way that the site works is that people read the books and they summarize the gist of the book, called “The Golden Egg”. Then, they also find two “Gems” from the book (accompanied by quotes). Here is a link to the summary of Good to Great by Jim Collins, so you can check out what I mean.

For the vast majority of business books, this site is amazing. I’ve long been a critic of these “single shot” business books. Typically, the author will have an idea that is good for 2-3 chapters, tops. After that, he’s beating a dead horse to try to hit some word count. For those kinds of books, Actionable Books is perfect. They’ll distill it down for you and you can get the idea without reading 200 pages of fluff.

For books that actually are full of value, you can read the summary and then – seeing the value – buy the whole thing. It is like a Book Review++++. So, if you are like me and like to read business books to build up your soft skills and business acumen, but don’t want to risk wasting your time with “low fat” books, check out Actionable Books.

Podcast Episode 48 – Coding is the Easy Part

Easy ButtonIn this episode, I take a look at a question that I ran across, “Is Coding the Easy Part?” I engage that question and take a look at everything that developers need to do to create quality software and try to figure out where the actual “writing code” part falls in the rankings.


Links Mentioned in this Show:
Quick Draw With Google

Listen To This Episode:

Down is the New Up

Down is the New UpWhat a time to be a .Net Developer. It used to be that one had to hang your head in certain circles when you were asked about your job. Admitting that you programmed in the Microsoft stack was seen as “less than cool”. All the cool kids were programming in Ruby, Node, Haskell, etc. Pick your poison. It was more popular than ever to write the “Why I’m Leaving .Net” blog post and just vamoose.

Recently, however, Microsoft has been changing ever since Satya Nadella has taken over. In reality, some of the changes started even before his arrival, but they have been leaping forward recently. .Net is Open Source, Microsoft projects are on GitHub and being developed in the open, and .Net has finally fulfilled its promise and is fully cross platform. You can develop full .Net apps on Windows, Linux, or the Mac and you can share the projects between the three without much issue.

Microsoft is now a Platinum Sponsor of the Linux Foundation. That means that Microsoft donates $500,000 annually to help the development of Linux, which is the highest level of sponsorship alongside Oracle, HP, IBM, and others. Google has joined the .Net Foundation to help steer .Net into the future.

TypeScript has gotten some wide adoption. After being made fun of for trying to “un-JavaScript JavaScript”, now some major JS players are using TypeScript. The Angular team at Google eschewed Dart (Google’s own thing) in favor of TypeScript. What is even happening to the world?

SQL Server is on Linux (in preview at the time I write this). That says almost everything there.

Visual Studio is available for the Mac (also in preview). I’m not talking about VS Code, I’m talking full Visual Studio.

The other night, I took a shot at this brave new world. I installed Linux Mint 18 Sarah (MATE version) in a virtual machine on my iMac and attempted to get a fully functional ASP.Net MVC site up and running. I will admit that the tooling is not quite there yet and I did spend about three hours on the entire process, but I learned a lot. There were some versioning issues, but I finally now have a complete working toolchain using VS Code, .Net Core, npm, and tools like Yeoman. Here was my first console application that I wrote:

My first working .Net app on Linux

After that, I got Yeoman installed and configured:

Yeoman on Linux

Finally, I was able to generate an ASP.Net MVC 6 site running on .Net Core developed and running on a Linux box that I set up.

An ASP.Net MVC Site on Linux

The future is here. As Apple continues to get more and more evil and not care about its customers, Microsoft is seeking newer and newer ways to engage developers across all spectrums. Honestly, engaging developers is always what they’ve done well. Now, they are just taking it to the next level. I can’t wait to get more and more of these kinds of applications into production and to be able to hold my head high and say that I’m a .Net Developer. I’m still waiting to read the first “Why I left Node for .Net” post, though 😉

« Older Entries