Data Type Precedence

Today, a generation task that we run monthly failed with the following error:
The conversion of the varchar value '31685772700' overflowed an int column. Maximum integer value exceeded.

Since the highest Integer number you can have is 2147483647 I knew what the error meant. When I looked into the code I found the column of the table where it was getting this value from. This column had a data type of varchar(50). Everything looked fine in the table so then I moved onto the query.

When I broke down the query line by line I finally found the culprit. There was an inner join that had that following clause:
columnwithhugenumber > 0

At this point I had my suspicions that the code was converting the column value into an integer before it compared the two, but why not convert the zero to varchar and compare? Well after some digging I found a very interesting answer. Did you know that some data types have a precedence over others?

So I used my favorite search engine and this is what I came up with. A full chart of Data Type Precedence. If you have two different data types to compare, whichever one is lower on this list will be converted to the data type that is higher on the list.

So with Int being 16 on the list and varchar being 27, that explains why it was erroring.

I tried a couple of different things, first I tried to cast the varchar value as a bigint as well as cast the zero as a bitint, but I received an error in doing this. Then, I tried to cast the zero as a varchar, which after I did it I realized it makes no sense and also errors.

So, finally to work around this I put single quotes around the '0' and it worked.

It makes sense that data types have precedence, but it never occurred to me until now that they did.

To criticize, or not to criticize

I came across a site the other day that was barely functional; sure, I could do what I set out to do, but wasn't easy or straight forward. It had me thinking about when I find broken code on sites that aren't mine or words spelled wrong or I've even found links that are broken because they had a period at the end of their <a> tag.

Occasionally, I write them an email and tell them about the mistake and how to fix it if I know, but mostly I ignore it and move on to another area of the site. I feel that I am hyper sensitive to these mistakes since I sometimes make them myself, and I have the tools and knowledge to debug a website, just for fun.

The one most recently was a restaurant that spelled gluten wrong, and I let them know in their contact us section. I just checked back to see if they ever fixed it out of curiosity and no they haven't. I'm really not sure why you wouldn't update that, it makes your restaurant look bad and the only people who are looking to see if you have gluten free options are the people who know how to spell gluten.

I know in a best case scenario there wouldn't be anything to criticize on your own site and everything would run smoothly and load quickly, but in that scenario where it doesn't do you welcome other programmers to criticize your site?

The Evolution of Mario

Just taking a break from the regular programming centered blog posts..

Mario first made an appearance in 1981 in the game Donkey Kong. Since then, Mario has been a super star, changing shapes and systems as time goes on. I was trying to find a picture of Mario through the years, but I came across this Awesome Mario Photo on a blog called Field iD. I have to say it was much cooler than a progression chart. My personal favorite photo (not game) is the Mario in the middle of the picture which is the Virtual Boy Mario from Mario Tennis.

According to Wikipedia, which is kind of sort of a reliable source the character Mario has appeared in 269 games. This list I found of course includes every variation of the same game across different consoles.

Our family was always a Nintendo family starting with the Super Nintendo. From then on we had all the models when they came out, 64, Virtual Boy, Game Cube, Wii, and of course every variation of Gameboy, starting with the regular gray one with the battery charger. To say that I had my fair share of Mario growing up would be an understatement, but who didn't dabble in their fair share of Mario games.

In this wide history of Mario games the newest one in the works for Wii U called Mario Marker shows Mario in a whole new light. It allows you, the user to build the levels for Mario to play in. Article about Mario Maker

I have to say I'm pretty glad this wasn't around when I was younger I could definitely see my brothers creating ridiculous levels and me getting frustrated trying to beat them, but I have to say I'm pretty excited for this one.

Mario Maker has a vague release date of 2015, so I hope to see some updates as we get closer to next year.

Using Java's Underlying RemoveRows() on a ColdFusion Query

I was looking into an issue recently, in which we wanted a subset of data returned from an existing ColdFusion query object. As a result, I stumbled across a useful Java function called removeRows(), which is an easy and efficient way to remove specific row numbers or ranges from a query.


Some great tools I found useful for building Phonegap Apps

Sometimes the world of the twitter feed moves a lightning speed. Lots of good information is shared at any given moment in time and then lost to the news feed that has moved on from past updates to more recent ones. I thought It would be good to share some cool items I found while on the twitters for mobile app/ web development.

  • Onsen CSS Components - great CSS components for mobile built on top of Adobe topcoat that look just like iOS 7 that can be used in HTML5 hybrid apps (phonegap) or mobile web.
  • Onsen UI - Front end UI framework created with AngularJS and Topcoat to help you achieve that native like experience. Think smooth screen transitions.
  • ionic framework - Another mobile targeted library and UI kit for mobile optimized HTML,CSS and JS hybrid apps. Also built with Angular JS.
  • Marvel App - Free mobile and web prototyping tool. Draw mockups, take a photo of them and then link up the images into a functioning prototype. Share the mocked up prototype with a link.

Open PDF bookmarks bar on open with CFDocument javascript and DDX

Recently I was tasked with what seemed like the impossible. I needed to have PDF's that were generated with CFDocument to auto expand the bookmarks bar in compatible PDF readers. Initially I thought it was impossible to do this after googling for a solution. However I did eventually find a solution hidden away in an Adobe help forum.

The solution was to write document level javascript that can included in the PDF via DDX and fires when the document is opened in a PDF Reader. The documentation for how to include document level javascript in a CFDocument generated PDF was not easy to find so I thought I would make it easy for the next person searching for this.


Oculus Rift

The Oculus VR company was recently bought by Facebook for $2 billion. Since, the company started 2 years ago my husband has been talking about it non-stop and will be the first in line when it goes public, even if many are unhappy about the Facebook buy out.

Oculus promises to take Virtual Reality to a whole new level, and Facebook plans on keeping up development of Oculus Rift their Virtual Reality Head Set. Check out this article that explains why Oculus Rift is going to be awesome. 7 Ways the Oculus Rift Could Change Entertainment as We Know It

According to the website you can pre-order your developer kit now for $350 and they expect to start sending them out July this year.

Pre-Order yours here

Replace All Not Replacing All Matching Substrings in CF 9

We have a process consuming data that is pipe delimited. As a part of this, we need to ensure that empty spots have spaces in between the pipes, so that each cell will keep its original position, because ColdFusion ignores empty list elements. I recently ran into an issue where we had multiple pipes, containing empty elements, occurring immediately next to each other - but the replace all was skipping over every other instance where our search string was side-by-side another instance of the search string.

For example, if this is our original string, "1|2||4|5||||9", our expected result was "1|2| |4|5| | | |9".


Safari issue with showing loading graphic on click

Untitled Document

Life as a web developer means checking your code in all browser environments . The unfortunate reality is that sometimes we do not do this and eventually come across something that does not work in one browser by accident. Recently I had an issue where Safari on a Mac was causing issues.

The issue was reported that the standard design pattern of prompting the user from a link click or form submission with a loading indicator like an animated GIF with javascript was not working in the most recent version of Safari on Mac. Upon testing the issue reported was correct and the loading graphics were not showing.

Here is what the code looked like that did not work in Safari.


view plain print about
1function goToLink(){
3        $('#somediv').html('<img src="loading.gif" > Loading...');
4        window.location.href = 'link.html?';    
6    }

The issue I found is that Safari for whatever reason does not allow or show DOM manipulation after a link is clicked or form is submitted. To fix the issue you need to delay processing to allow time for the DOM to be changed to show the loading image and then execute the browser change location. Here is an example of how to do this...


view plain print about
1function goToLink(){
3        $('#somediv').html('<img src="loading.gif" > Loading...');
4        setTimeout(function(){
5            window.location.href = 'link.html?';    
6        },1000);
9    }




Using Modernizr to Detect HTML5 Feature Support

The problem: you want to use HTML5 features or libraries on your site, but you also want to support older browsers. Fortunately there is a library called Modernizr to help. Because HTML5 is not simply one thing, it is not possible to simply detect HTML5 compatibility as a whole, and using browser specific checks is an archaic practice that is not a solid solution because some browsers do have partial HTML5 support which means those users would miss out on content regardless of browser support. Instead, the proper method is to detect support for specific features of HTML5. Modernizr makes this process easy.

An example of this would be HTML5 video. In order to use Modernizr to check for this it is very simple.

Example index.html:

view plain print about
1<!-- Place the include in the head after any CSS includes. --> <!-- This should in the head because HTML5 Shiv (included library to enable HTML5 elements in older versions of IE) must execute before the body and if the page uses any CSS from Modernizr this will prevent a "flash of unstyled content." -->
3    <script src="modernizr.min.js" type="text/javascript"></script>

Example script.js:

view plain print about
1if ( )
3    if ( )
4    {
5        // Try WebM
6    }
7    else if ( )
8    {
9        // Try Ogg
10    }
11    else if ( )
12    {
13        // Try H.264
14    }
18    // No HTML5 video supported, at this point you can use a flash player or another solution.

Modernizr works for many other HTML5 features as well miscellaneous things such as CSS3, geolocation, SVG, WebGL, and more. For more information and to download Modernizr, visit

More Entries