Nifty free tool from Red Gate Software

I found this tool a while back, but totally forgot to put up a post about it: SQL Search.

It’s a free utility (at least for now it is) which is an add-in for SSMS. Once installed, it puts a button on your SSMS toolbar. Clicking on it brings up an interface to let you search through code and objects in the database for whatever you enter. It’s very fast, and shows you highlighted previews of the code or object definitions. Searches can be targeted to different types of objects, and switching between the databases on the server is done simply through a drop-down list. If you’re just trying to find something in the database code and don’t want to fire up VS to do so, this is a real boon.

You can find it online at: http://www.red-gate.com/products/sql-development/sql-search/

You are not a beautiful and unique snowflake

You are not a beautiful and unique snowflake

This link is to an article created by Freshdesk – our help desk software provider. The article’s title is about why you shouldn’t make customers pay for support but what I found interesting were some great insights on the value we (as a software development company) gain from help desk tickets.   “You are not a beautiful and unique snowflake….” is my favorite! Freshdesk uses a subscription model so I would argue they do charge for support as part of their monthly fee, and after all, it has to get paid for somehow … unless of course I can get all you to work here for free :-)

New Zealand Bans Software Patents

An interesting article: http://arstechnica.com/tech-policy/2013/08/in-historic-vote-new-zealand-bans-software-patents/

While we obviously are interested in protecting our product IP as well, I think this has to be balanced against the probability all software developers would violate the “patents of the obvious”. That situation would be exclude smaller firms like ours from building software at all, since doing so would require significant legal effort to avoid patent infringement – and/or infringement defenses.  Even with present legislation I would say copying of software characteristics and features is unavoidable.  I would however, draw the line at unauthorized copying of raw IP such as source code, models and technical documentation.  That must remain protected – and all of us must maintain our vigilance to safe guard it.

Let me sing the praises of Internet Explorer…

Then again, maybe let’s not.

Recently, I was asked by Saskatchewan Finance to figure out why their SETS tax filers who were using Internet Explorer were no longer being prompted if they wanted to save their user names and passwords. It used to work fine in the old version of their site, but ever since the launch of the new, shiny ASP.NET version of the site, this stopped working for anyone using IE. Just like a lot of other browsers out there, IE has a wonderful feature in it that they term “autocomplete” for forms; in fact, IE7 was the first browser to launch such a feature. The best part of it is that it will remember your logon ID and password for whatever sites you tell it to, and stores them in an encrypted password store.

This feature was working fine for all the other browsers visiting the SETS login page, oddly enough. After much testing and sleuthing, I discovered that IE is a bit more restrictive when it comes to employing autocomplete for a login page. Strangely, if it sees any other fields on the same page as the login form, it turns autocomplete OFF. Without telling the user. Especially if you’re submitting the form using JavaScript, which a lot of rich-UI forms do nowadays on the web.

While this likely won’t come up for Synoptec, it will probably come up for other projects, especially in the custom projects that Alinity does, and possibly in other HCS projects. There is, thankfully, a solution to this, though the knowledge of it is hard-won, as it is not well documented either by Microsoft or the developer community.

The first thing I found was that there is a special method you can call from IE’s internals, via JavaScript: window.external.AutoCompleteSaveForm(formID). While window.external exists in all browsers to provide extension points, this particular method only exists in IE, which means you have to check to see if the method exists before you try to call it. Detecting it safely and properly took a little more sleuthing to sort out, but not much.

The last, and most important part of the solution, took far more sleuthing than I figure it should have. Nearly all the articles I came across on this mentioned just calling the AutoCompleteSaveForm method. What they neglected to say was that this simply sets a flag for the web page’s form to tell the browser that when the form is finally submitted, it should do what it can to save the form’s elements in the autocomplete store. The way most of the articles read, it seemed that calling this method would do the form submit for you as well.

So, if you run into this situation, here’s the meta JavaScript code you need to make it all fall into line:

try
{
  // have to do the check inside a try/catch block because some installs of IE
  // kick up an error when trying to determine the type of "window.external.AutoCompleteSaveForm"
  if (window.external && (typeof window.external.AutoCompleteSaveForm == "unknown"))
  {
    window.external.AutoCompleteSaveForm(formID);
  };
}
catch (e)
{
  // ignore the error
};

formID.submit();

The reference to "formID" above is for the ID of the web form you're wanting the autocomplete to work for.

27 Things Only Developers Will Find Funny

27 Things Only Developers Will Find Funny

Actually forwarded to me by Lynn so maybe some are funny to non-developers.  BTW – does #2 remind you of anyone?

Windows Azure Active Directory

Paste a Video URL

This is an important video for all developers to be aware of, and for those responsible for architecture to review in detail. Interesting stuff!

http://channel9.msdn.com/Series/Windows-Azure-Active-Directory/Windows-Azure-Active-Directory-Cartoon

It seems video links don’t ever post correctly in WordPress so I pasted it again above.

Building, Deploying and Publishing DB Projects – Part 2

The link below provides a video of the process for reverse engineering structural changes made to the framework DB to the database, and for adding a couple of objects directly to the project.  The process then goes through building the project, verifying it by deploying back to the design database, and generating an updated dacpac for the framework DB to use in other projects.

http://screencast.com/t/4G2hNAyFyt

Building, Deploying and Publishing DB Projects – Part 1

This is the first in a series of blog posts demonstrating our process for building, deploying and publishing database projects. The emphasis is on best practices for working with our framework DB project (the “sf” schema objects) inherited by our main projects, and methods for managing dacpacs.

This first video demonstrates the approach for making changes to database structures in the SGIFramework DB.

http://screencast.com/t/EpK4p1rbm

Log Space Management

Back by popular demand, a re-post of some useful TSQL snippets to manage log space in databases.  The script shows how to set databases to “simple recovery mode” to avoid logging (for development and test databases ONLY), how to set the maximum size of the log, and how to view the current log space and shrink it to a minimum size.

– use this command to look for databases that are NOT in simple recovery mode

– NOTE: use SIMPLE recovery mode for development and test databases only (to avoid

– logging)

use [master]

go

select

‘alter database [' + name + '] set recovery simple with no_wait’ SQLCommand

from

sys.databases

where

database_id > 4

and

recovery_model_desc = ‘FULL’

– use this command to set maximum log file size to 200MB

– query creates the command only for DB’s with unrestricted log growth

– or where growth size is >

select

db.name                                 DatabaseName

,f.name                                         LogicalFilename

,f.filename                       PhysicalFileName

,f.maxsize        MaximumLogSize

,’alter database [' + db.name + '] modify file ( name = N”’ + f.name + ”’, maxsize = 204800kb )’  LimitLogSizeSQL

from

sys.sysdatabases db

join

sys.sysaltfiles f on db.dbid = f.dbid and f.fileid = 2

where

db.dbid > 4

and

(f.name like ‘%log’  or f.name like ‘%log_’)

and

(f.maxsize > 25600 or f.maxsize = -1)

alter database [SETSDev] modify file ( name = N’SETSDev_log’, maxsize = 204800kb )

– use this command to shrink logs

select

db.name                                 DatabaseName

,f.name                                         LogicalFilename

,f.filename                       PhysicalFileName

,f.size           FileSize

,’use [' + db.name + ']; dbcc shrinkfile(‘ + f.name + ‘, 1)’  ShrinkSQL

from

sys.sysdatabases db

join

sys.sysaltfiles f on db.dbid = f.dbid and f.fileid = 2

where

db.dbid > 4

and

db.mode = 0

and

(f.name like ‘%log’ or f.name like ‘%log_’)

order by

1

 

 

 

 

Table Partitioning – Applied

I read this article this morning and found it very interesting.  I wasn’t particularly interested in the original objective of the article  was to create a logging table sub-system that can handle hundreds of millions of rows per day.  As I began scanning the article, however,  I became more and more  interested in the approach the author uses to partitioning. In particular, check out the “Switch” statement used to convert existing data into the first partition of the new data.  Then, check out how the first partition data is migrated automatically every  midnight into the next partition.  Interesting stuff.  

I checked out a couple of other articles by this author – “” definitely a SQL-smart-pants :-)

https://www.simple-talk.com/sql/t-sql-programming/painless-management-of-a-logging-table-in-sql-server/