Detect Browser, Platform, and Touch Capability Using Javascript

Here’s a method of detecting which browser you’re using and whether you’re on a mobile or desktop platform: <script type=”text/javascript”>   <!–   var userAgent = navigator.userAgent || window.navigator.userAgent;   var nav = navigator || window.navigator;   var isDesktop = nav[‘platform’].match(/(Mac|Win|Linux)/) && !userAgent.match(/Android/);   if (isDesktop) {     alert(“You’re on a Desktop!”);   };   –> </script> Need …

MSSQL 2005 Dynamic PIVOT

Here’s a method of generating a dynamic pivot of a dataset. It first generates the columns as a string (“[ColumnHeader0],[ColumnHeader1],[ColumnHeader2], …” format), builds a dynamic SQL string and executes it using the PIVOT expression. From the code below, the @cols variable is generated by using the FOR XML PATH expression. …

iOS6 Removed Mouse Events in Safari/UIWebView? (Updated)

UPDATE 10-08-2012: Here’s a blog entry on how to determine if the device you’re on has touchevents enabled. Note that most Javascript libraries/frameworks should already have some sort of detection for this built in. My demo for using Cubiq.org’s SpinningWheel control stopped working on iOS6. The issue was that I …

CSS3 Image Reflections

Kind of a cool effect. Here’s an example: To get the image reflect on the bottom, I used the following CSS: -webkit-box-reflect: below 5px -webkit-gradient( linear, left top, left bottom, from(transparent), color-stop(0.75, transparent), to(rgba(255,255,255,0.3)) ); Here’s some other options: Basic -webkit-box-reflect: below; Offset -webkit-box-reflect: below 5px; Masking with Gradient -webkit-box-reflect: …

NSThread in Objective-C

I had an issue in my iOS application at work where there was a long pause while the view for a QR reader was initializing. So I decided to use Cocoa’s Activity Indicator to try to give a better user experience. I would show the indicator before the view initialized …