Nov 30

SQLServerCentral sends out a daily email and today had an interesting offer to take a survey from redgate.  They were asking questions of Visual Studio developers that heavily use/interact with databases.

If you fit into this crowd help out by taking their survey here.

Initially I really distrust the idea of having SSMS like functionality within VS.  I know it is already there but I just have really avoided them, though I try to use them from time to time just to give them the benefit of the doubt.

For some reason Microsoft tends to like to dumb down anything in VS that’s not strictly developer oriented.  This is a huge separation from their current “give the power to the programmer” mentality when it comes to features like VS Add-Ins, NuGet, T4 templates, EF4 Code First, etc.  For some reason DBA tools have fallen into this “black magic, we’ll hide it for you” dark side of VS.  So, since VS 2003 and probably a little before, any database interaction was kept at a very high level.  You simply couldn’t dive right into necessary tools like T-SQL easily.

Consequently I’ve always developed with VS and SSMS side by side.  So, I’m in that old school stick in the mud crowd waiving my cane in the air shouting, “I’ll give you my SSMS when you pry it from my cold, dead hands!” Call me old fashioned.

As SSMS just continues to improve (throw SSMS Tools and other indispensible add-ons in the mix) I have had no desire to even attempt DBA functions within VS.  Honestly, SSMS is becoming so nice to use it is pretty much on par with my respect of VS 2010 as the developers IDE.  SSMS is the DBA’s tool of choice for me and quite happily so.

If they literally took SSMS and put it into VS I think I’d still avoid it.  The need to Alt-Tab between the two really creates a mental context switch in my head that helps my productivity.  Read my post on Alt-Tab Aids My Mental Context-Switching for more info on this, but it is a real productivity asset to think about.

If switching between SSMS and VS tools (literally and mentally) all inside the IDE were any more complicated than a simple Alt-Tab I would not be inclined to switch. 

It would need to offer enough extra "can’t live without" features to overcome the current simplicity of Alt-Tabbing between VS and SSMS.  For instance, I would love the idea of being able to code against a dev database and having the IDE help generate a change script, all which would be kept in source control.  The entire database design should be kept in my source control as well, so that when I add a column or an index the change script and create script are entered on the next commit.

Nov 30

A recent blog post about combining the functionality of SQL Server Management Studio within the Visual Studio IDE got me really thinking.

Any any given moment I have at least 6-8 applications running, usually quite a bit more.  When developing an app I usually have a work environment consisting of VS 2010, SSMS, Firefox (with at least 6 tabs open), Outlook, Word, etc.  Each application is only an Alt-Tab away.

I initially rebel at putting SSMS DBA features into VS2010 (yes, I know they are already there, I just don’t use them).  Much of this has to do with the fact that historically these tools have lacked functionality, but I now realize a large part is the mental context switching that Alt-Tab provides.

If someone walks into my office or a phone call grabs my attention I can easily Alt-Tab to another app, or simply Ctrl-T to open a new tab in Firefox (which starts at Google) ready to handle that particular request.  It doesn’t matter what I was doing before.  For some reason Alt-Tab simply puts my current mental state on the stack (forgive the metaphor Winking smile) ready to be called up when I Alt-Tab back sometime in the future.

Switching between different duties using Alt-Tab seems to really trigger a context switch in my head.  All this happens in the .2 seconds it takes to press Alt-Tab.

While DBA duties are really integrated into my development process (in my work I am the developer and DBA) I love the clean separation of concerns when I Alt-Tab between VS and SSMS.  Even if SSMS were completely duplicated within VS I don’t think I’d care for it.  There is just such a satisfaction with mentally putting on my DBA hat for SSMS work, even if it is simply for 20 seconds while I add a column to a table.  It just seems cleaner.  Unless the integration of the two tools really provides support that each tool individually couldn’t accomplish I actually see less value in combining these.  Additional features, such as integrating source control over my database assets and generating data migration scripts, would prepare me to mentally believe these two tools really should be combined.

Now I guess I need to start to evaluating add-ons and other tools based on how easily I can task-switch the context in my head when I need to use them.

Oct 14

Sometimes it’s the little tools that really make your day.

 

I finally got fed up with my growing JavaScript files and thought it would be great if Visual Studio allowed me to collapse functions just like it does with c# and other source files.  So I did a Google search.

 

Well, Velio Ivanov created a great little Add on that does just this and for CSS too!  Thanks Velio!!!

 

Check it out: http://jsoutlining.codeplex.com/

Jul 14

PowerShell is a lot of fun but I don’t always get to play with it.  Anytime I have to do large tasks that move a lot of simple data or AD type tasks then I’ll sometimes pull it out.

Recently we installed Windows 7 across our district.  During that process we renamed all the computers because our old naming convention wasn’t always followed and it created a lot of confusion and inconsistency.

All our library staff computers have a special application that allows them to download barcodes that are read using a handheld barcode scanner for inventories.  This previously was pushed out by a group policy.  Since the computers were erased during the Win7 install and the computer names had changed we had about 25 computers that needed to be added to the group again.

Sounds like a perfect chore for PowerShell.

First of all, I forgot the name of the group that they needed to be added to, but I knew it had “dolphin” in the name, since that is the name of the software.  Active Directory Users and Computers (ADUC) won’t let you search on a portion of the name, just the beginning or the end.  Not much help there.

PowerShell makes this trivial:

Get-ADGroup -filter {name -like "*dolph*"}

This returned the following:

DistinguishedName : CN=g-InstallLibraryDolphin,OU=Computer,OU=Software Install,DC=valverde,DC=edu
GroupCategory     : Security
GroupScope        : Global
Name              : g-InstallLibraryDolphin
ObjectClass       : group
ObjectGUID        : 0909537b-ddcc-41c1-bd37-667fdb943a95
SamAccountName    : g-InstallLibraryDolphin
SID               : S-1-5-21-1659004503-746137067-682003330-69446

That’s the one!

Our naming convention for or library computers is wXX-Library, where XX is the two character code for the school the computer is at.  However, simply filtering on this wouldn’t help, because we name all our library student computers as follows: wXX-LibrarySYY, where YY is simply a number stating at 01 and goes up for however many student computers are in the library.

So, here is the PowerShell command that stores all our library staff computers into a $libcomps variable, excluding the student machines:

$libcomps = Get-ADComputer -filter {name -like "*library*" -and name -notlike "*libraryS*"}

Since you cannot pipe computer objects straight into the Add-ADGroupMember commandlet (why, I have no idea but it doesn’t make sense to me) you have to iterate over the $libcomps collection and add them one by one:

foreach ($c in $libcomps) {Add-ADGroupMember g-InstallLibraryDolphin -Members $c}

The command ran for about .25 seconds and did all the work for me.  I think researching the right commands to use took about 2 minutes, which is still faster than had I had to move them all over one by one. 

Heck, this post took longer than the entire task all together. Smile

Jul 7

This was a pretty amazing article about how to extend your jQuery code even further using Amplify.js.  Elijah has a great writing style with very organized and clear examples. 

He first starts out with what I think is a pretty nice and clean example app.  Then he proceeds to discuss various improvements he makes using Amplify.js and refactoring to various patterns that really start to bring out the flexibility of the app.

Definitely take a look!

http://msdn.microsoft.com/en-us/scriptjunkie/hh147623.aspx

Jul 6

This is just amazing stuff.  When Microsoft Surface first came out you knew this was opening the door to the future.  All the flashy futuristic movies where video screens are interactive and everywhere, tables, walls, etc are now coming to reality.

With Surface 2 they have really taken a huge leap forward.  Now they are using LCD screens with what they call PixelSense technology.  Along with R, G and B pixels there is now a fourth pixel that can detect in the infrared range.  The LCD screen actually can detect the objects on the table.

What this does is change the older hardware with complex projectors, cameras and sensors into a sleek tabletop design.

Just to give you an idea here is what the original Surface typically looked like:

The large enclosed portion below the glass is actually hiding the set of projectors and cameras along with the computer hardware.

Now, with most of the complex sensing technology actually built into the LCD they can now produce tables that look like this:

I’ve seen Microsoft Surface products built into the wall at fancy hotels or casinos in Las Vegas.  Now we’ll start seeing a lot more of these pop up everywhere.

It’s an amazing time to be alive! Smile

Feb 11

Have you ever wished that hitting the F1 key in Visual Studio actually returned good search results in a quick manner? 

Personally I think the F1 key returns decent results, but there certainly are a lot out there who don’t.  I mostly work in .Net so I’m in the camp of users that F1 works well for.

The think I really don’t like though is the 30 seconds or so it takes to launch the help window.  Once you’re there navigation is pretty painful.

For the last several years I’ve all but abandoned F1 and just search Google with “msdn” and my search term.  95% of the time this returns exactly what I want in the first hit.

Wouldn’t it be nice if we could make Visual Studio do this for us?  Well, we can, and have been able to for years!

Check out OriginalGriff’s solution on Code Project.  He clearly outlines the steps and I have to say his solution is quite nice and tidy.

However, I had two very minor criticism, purely for my own tastes.  This solution opens the webpage inside of Visual Studio’s web browser inside the IDE.  This works, but I really like using my own default browser (currently Chrome).  This allows me to open up various hits in several tabs and bookmark interesting solutions.  I can’t do that in the VS browser window.

Second is it grabs the selected text and performs the search on this.  If you don’t select anything it just opens up a search for “msdn”.  The original F1 functionality use to search whatever word your text cursor was on, nothing had to be selected.  I’m lazy and I like this ability.

Last, but not least, as I was writing this blog post and stated above that 95% of the time my search term came up in the first result it hit me. OMG If I think that what I want will be my first hit, why not just return Google’s first result; the equivalent of hitting the older I’m Feeling Lucky button on Google’s home page. If you look at Griff’s solution you will see below it that I proposed an alternate solution that adds these three features.  Now, when I hit F1 or Shift+F1 I, respectively, get the Google search or the first hit directly.

Enjoy!

Dec 16

When you are a website developer, hardly ever do you get to mandate what browsers your users will use.  At my last employment we built a lot of Intranet web applications for our users, who all used the same version of IE that was managed automatically on their work computers via Active Directory.  That was nice.

At my current position the websites I create are used by a variety of school districts and the public.  While the majority of users are browsing my sites with IE7 and IE8 there are a few Chrome, FireFox, Safari and, yes, IE6 users.

 

There is a great community of software applications and web services to help you test how your site will react with different browsers.  Most of them are fairly static showing you how a page will render, but with highly dynamic sites you just need to see how it will work on the actual browser.

Fortunately Microsoft makes this really easy by releasing VHDs with various operating systems and browsers loaded, from WinXP and IE6 up to Vista and IE8.  That’s not the whole Microsoft gamut but it is a good portion and easy to use.  Just load up Microsoft Virtual PC and you are set to go.

Take a look at Microsoft’s offerings here.

Dec 7

We have Policies and Procedures document that we are making available on our website.  This document in its entirety easily spans several hundred pages and has a pretty lengthy table of contents. 

To help make this easy to navigate and easier to consume we are posting several of the larger topics as individual documents and making them available from a linked table of contents that is created as a web page.

The requirement is that the table of contents uses different numbering styles at each indentation.  So, for instance, the outline below:

Topic A

   Sub-topic A.1

   Sub-topic A.2

      Sub-topic A.2.1

      Sub-topic A.2.2

Topic B

Topic C

would become:

1. Topic A

   a. Sub-topic A.1

   b. Sub-topic A.2

      i. Sub-topic A.2.1

      ii. Sub-topic A.2.2

2. Topic B

3. Topic C

This document isn’t maintained in a database yet so for now the table of contents is created in good old fashioned HTML.  Using a standard <ol> (ordered list) element in HTML looks initially like this:

  1. Topic A
    1. Sub-topic A.1
    2. Sub-topic A.2
      1. Sub-topic A.2.1
      2. Sub-topic A.2.2
  2. Topic B
  3. Topic C

The way to change the numbering style is by using the CSS list-style-type style on the <ol> element with various options such as decimal, lower-alpha and lower-roman.  You can find a great example of this at w3schools.  So, I could manually change the list style of each <ol> tag based on how much it was indented, but this would be a pain to maintain.  Anytime we changed the layout I would have to change the list-style-type styles and be sure to keep everything consistent.  I thought this would be a perfect place to use jQuery.

Using jQuery I was able to define an array of the types I wanted to use.  jQuery would then find all the <ol> and nested <ol> elements and change the style for each indentation.  Once done I could simply maintain the table of contents and jQuery would handle the styling. I couldn’t find any jQuery plug-ins that did this so here is the code I came up with.  If I end up using more than a couple of times I’ll probably create a plug-in for it.

1: function styleOutline() {
2: // List-item-styles we would like to use
3: var olStyles = ['decimal', 'lower-alpha', 'lower-roman'];
4:
5: // Process the parent element.
6: styleOl($(‘ol:first’), 0);
7:
8: function styleOl(element, styleIndex) {
9: // Apply style
10: element.css(‘list-style-type’, olStyles[styleIndex % olStyles. length ]);
11:
12: // Call recursively for each nested ol
13: element.children().each(
14: function (i) {
15: var ol = $( this ).children();
16: if (ol) {
17: styleOl(ol, styleIndex + 1);
18: }
19: }
20: );
21: }
22: }
23:

This works great and took me only a couple of minutes to do. Definitely an improvement over the manually written way.  I hope this helps someone else out there!

Dec 1

We recently migrated from one online IEP vendor to another.  This is a program for collecting and managing Special Ed information, but it is an enterprise app and worthy of critique and comment.  They do a great job, but there are some small UI issues I wish could be fixed.

For instance, when you enter data onto a form and try to leave the form without saving they do a nice job of alerting you that you are about to lose the valuable data you just entered.  However, there is a catch:

SNAGHTML97e6ac4

Ouch, did you read that correctly?  “Hit CANCEL to Leave this page.”  The problem with that is I would say 99% of users are used to hitting Cancel when they realize they made a mistake and want to undo it.  Several times I’ve had to stop my knee-jerk reaction to hit cancel when I realized I updated something and didn’t hit Save.

Not only are the button actions inconsistent with what users are used to but I would go further and state they are actually opposite, which to me is one of the worst UI anti-patterns.  In addition the buttons are not very informative, OK and Cancel just don’t tell you what they are doing with your data.  Unfortunately I think it might be stuck as it is.  The software now boasts adoption of over half the state of California.  That’s a good sized client base and the current users are already conditioned to hitting OK to go back to the page and hit the Save button.  If the vendor were to reverse the impact of the buttons now I can just imagine the outcry there would be over users losing data because they are simply used to hitting OK.  You see, no matter how many emails, home page news alerts or training documents you give out half the users won’t even bother to read them.  They won’t know there is a change until they have already lost their data.  Not a good thing.

If I were to have to implement this change I would re-label the buttons all together.  This would not only alert the user that something functions differently then what they are used to but it would also make the dialog more usable, which is also a good UI pattern.  Unfortunately you cannot do this with plain JavaScript.  Since the vendor already makes use of jQuery the UI Dialog plug-in is a great tool to use.  It also standardizes the dialog boxes since JavaScript alerts are handled inconsistently between browsers.

Here’s a sample of what I would do using the jQuery UI Dialog plug-in.  I think it is easy to read and clear in informing the user on what they are about to do.  While this would be a change to what users are used to I think it would be one that is easily adapted to.

image

« Previous Entries