New Line Annoyance

by Garrett 26. February 2014 00:25

I fought today creating an .aspx page for submission to a payment processing vendor in which I needed to add controls dynamically to a page before posting it.

I've done this sort of thing before, but what I struggled with was adding linefeeds (or carriage returns) after each new control (hidden field) for readability. I found a post (and unfortunately lost the url so I'm unable to credit the poster) which suggested using Environment.NewLine instead of something like vbcrlf or "<br />".

This lead me to: 'phDynamicFields.Controls.Add(New LiteralControl(Environment.NewLine)) which works like a charm.

Hope this helps someone else.

- Garrett

 

Del.icio.usDigg It!StumbleUpon

Tags:

Microsoft Visual Studio Annoyance

by Garrett 13. February 2014 00:07

I am currently working on converting a large classic .asp web site over to .NET using Visual Studio 2012 (which is a decent tool), but one of the things that was truly driving me crazy as I was copying in large chunks of generated1 .asp code, is each time I would modify the .asp/HTML code there would be a 5 to 15 second pause (quad-core cpu chugging away) while VS was attempting to render(?) the html, even though I was strictly using Source view (as opposed to split view).

I had previously read helpful posts about VS2008 / 2010 regarding uninstalling Microsoft's Visual Studio Web Authoring Component, but VS2012 appears to have this functionality integrated into the studio suite itself, and I was unable to uninstall it. What I did to finally fix this annoyance was to uncheck "Enable HTML designer (requires restart of Visual Studio)" in Options, under HTML Designer. After restarting Visual Studio and re-opening my project, all is well again.

1Generated by a tool many years ago - not unusual to have 10,000 lines of html for formatting, with the old script tags <% %> embedded throughout.

** Update 19 March 2014:  Well, this seemed to work for a few days, but then the problem was back -- not sure why.  But, I found another solution which seems to work here http://weblogs.asp.net/fmarguerie/archive/2009/01/29/life-changer-xaml-tip-for-visual-studio.aspx.  I now open the .aspx files using "Source Code (text) Editor". The eliminates the "split view" option, but I don't use that anyway...  Hope this helps.

 

Del.icio.usDigg It!StumbleUpon

Tags:

Halloween Left and Right Story

by Garrett 1. November 2013 17:49

I whipped up this little story for my daughter's 4th grade Halloweeen party at school.  It's for a game where you put the kids in a circle and hand them something to pass around (a pumpkin, skull, spider, etc).  Each time the word right is read in the story, the person with the item should pass it to the person on their right, and when left is read, to their left.

Many years ago, before most of you were born, there was a teacher here at Genoa Elementary named Mrs. Wright who taught fourth grade.  The town was really, really small back then – there were only seventeen boys and sixteen girls in the entire town.  Mrs. Wright knew all of them, and had most of them as students at one time or another.  Well, there were seventeen boys at the beginning of the year – but right after Halloween, everything changed.

There was a Halloween parade and each class had a party, just like today’s festivities, but that particular Halloween left the entire town changed forever.

The parade was different back then.   The girls walked down the right side of the hall, and the boys walked down the center.   The left side of the hall was reserved for parents and teachers.  As the children left the hallway and entered the gym, some of the parents realized that something wasn’t right.  They weren’t sure exactly what wasn’t right, but it left them with an eerie feeling as the children walked by.

Later that day, during the classroom parties, Mrs. Wright was nowhere to be found!   The students swore she was right there a few minutes ago, but some of the parents said they thought she left right after the parade.   It was a mystery alright, but one that was about to be solved, right in front of everyone.

Just then, Mr. Wright burst into Mrs. Wright’s classroom.   He ran quickly to the left side of the room where the parents and other teachers were standing and whispered something to them – none of the kids on the right side of the room could hear what was said, even though they were right there in the same room.  The parents and teachers looked SHOCKED as Mr. Wright whispered to them!

Mrs. Johnson stepped toward the children, looked right at them with a serious face and said, Mrs. Wright just had her baby – there were now EIGHTEEN boys in Genoa! 

Our classroom was arranged in such a way that we had about six groups of 4-5 children in each circle, and we let each child with the item they were passing around keep it at the end of the story.  They enjoyed the game enough to let me read it again.  

Feel free to use this story at your next party - simply change the name of the town if you wish...  If you re-post this story, I just ask that you don't claim you wrote it.

Del.icio.usDigg It!StumbleUpon

Tags:

SQL Server Management Tree Expansion Error

by Garrett 25. July 2013 22:33

Failed to retrieve data for this request.  (Microsoft.SqlServer.Management.Sdk.Sfc)  The server principal is not able to access the database under the current security context.

I decided to add this to my blog since every time I install Microsoft's SQL Management Studio I run into this issue.  As seen by the error below, when you attempt to expand the Databases folder in the Object Explorer (if you are on a shared / hosted server), you will receive this error because the tool is attempting to read data from databases that you do not have permission to.

The simplest way to prevent this error and allow you to access your database(s) is to connect to the server, click the Databases folder in the tree (Object Explorer), then right click the column header row (Name | Policy Health Status | etc) and deselect Collation.  It should be that simple.

Del.icio.usDigg It!StumbleUpon

Tags:

Made By Tammy

by Garrett 22. February 2011 20:00

My wife's online business, rooted at madebytammy.com, even through these tough economic times, (albeit slowly) has continued to grow.  I truly believe that the customer service she provides is one of the primary reasons she continues to be successful.

There are hundreds, if not thousands of artisan jewelry crafters selling their wares online, so how does a potential customer choose a seller?  I believe there are several factors that come into play, with the primary three being price, quality and service.

There are times when all that matters is price.  As long as the item arrives by the time it is needed, quality might be low on the list of requirements.  Then there are times where quality is of the utmost importance.  It is oftentimes worth paying a little extra for something special that is perfectly crafted, and that will last a lifetime.  For all the times in between, I believe customers will return to a place where they are treated just a little better than everywhere else.  And I believe this is what you get when you purchase something from madebytammy.com.  Her prices are extremely reasonable; she puts her heart into every piece she creates; her quality is top-notch, and roughly half of her shipments leave the house the day payment clears, with the other half leaving the following business day. 

Some people like numbers, so here is numerical proof of her willingness and ability to make her customers happy: As of the writing of this post, she has 6,632 positive feedback responses from her shops at etsy.com. That's 6,632 satisfied customers out of 6,632 sales, or 100%. (jewelry / supplies)

So the next time you're looking for something special for yourself, or a gift for that special someone in your life, give MadeByTammy a try - I personally guarantee you'll be glad you did.


Del.icio.usDigg It!StumbleUpon

Tags:

VS2008 Collapse All (CollapseAll) Macro

by Garrett 29. September 2010 17:38

Here's a different version of the macro that works with Visual Studio 2008.

Original location of this macro:  http://it.toolbox.com/blogs/think-clients/visual-studio-macro-collapse-solution-explorer-18035


Here is the macro code, simply use the instructions for the 2005 version if you are unfamiliar with how to create a VS macro.

Public Module Collapse
   Sub CollapseAll()
     ' Get the the Solution Explorer tree
     Dim UIHSolutionExplorer As UIHierarchy
     UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
     ' Check if there is any open solution
     If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
       ' MsgBox("Nothing to collapse. You must have an open solution.")
       Return
     End If
     ' Get the top node (the name of the solution)
     Dim UIHSolutionRootNode As UIHierarchyItem
     UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
     UIHSolutionRootNode.DTE.SuppressUI = True
     ' Collapse each project node
     Dim UIHItem As UIHierarchyItem
     For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
       'UIHItem.UIHierarchyItems.Expanded = False
       If UIHItem.UIHierarchyItems.Expanded Then
         Collapse(UIHItem)
       End If
     Next
     ' Select the solution node, or else when you click
     ' on the solution window
     ' scrollbar, it will synchronize the open document
     ' with the tree and pop
     ' out the corresponding node which is probably not what you want.
     UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
     UIHSolutionRootNode.DTE.SuppressUI = False
   End Sub

   Private Sub Collapse(ByVal item As UIHierarchyItem)
     For Each eitem As UIHierarchyItem In item.UIHierarchyItems
       If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count > 0 Then
         Collapse(eitem)
       End If
     Next
     item.UIHierarchyItems.Expanded = False
   End Sub
End Module

Del.icio.usDigg It!StumbleUpon

Tags:

VS2005 Collapse All (CollapseAll) Macro

by Garrett 9. July 2010 17:14

I've used this macro for years on each machine I've used for development, so I thought it would be prudent to pass it along to anyone who stumbles upon my site.

Original location of this macro:  http://www.imiscommunity.com/visual_studio_2005_tips_and_tricks


Here is a macro to collapse all projects in a solution and expand the selected project:

  1. Select ALT+F8 on your VS2005 IDE to open the macro explorer
  2. Right Click MyMacros.
  3. Select New module.
  4. Type the new module name as CollapseAll
  5. Select OK – A new module CollapseAll is created.
  6. Right Click CollapseAll Module
  7. Select Edit – The Macro IDE is launched.
  8. Copy the following Sub and paste it between the module and End module. -- in the Macro IDE (you may need to adjust some lines in order to successfully compile the macro):

    Sub CollapseAll()
    'NavigateSolution()
    ' Get the the Solution Explorer tree
    Dim UIHSolutionExplorer As UIHierarchy
    UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
    ' Check if there is any open solution
    If (UIHSolutionExplorer.UIHierarchyItems.Count = 0)
    Then
    Return
    End If

    ' Get the top node (the name of the solution)
    Dim UIHSolutionRootNode As UIHierarchyItem
    Dim UIHChildItem As UIHierarchyItem
    UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)

    ' Collapse each project node
    Dim UIHItem As UIHierarchyItem
    For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
    For Each UIHChildItem In UIHItem.UIHierarchyItems
    UIHChildItem.UIHierarchyItems.Expanded = False
    Next
    UIHItem.UIHierarchyItems.Expanded = False
    Next
    UIHSolutionRootNode.UIHierarchyItems.Expanded = True

    Dim UIHSelectedItem As UIHierarchyItem = UIHSolutionExplorer.SelectedItems(0)
    UIHSelectedItem.UIHierarchyItems.Expanded = True
    End Sub

    Save the module.
    Now add this macro to the toolbar for easy access.

  9. Select Tools -> Customize from the main menu
  10. Select the Command tab in the Customize dialog
  11. Select Macros
  12. Select the CollapseAll macro and drag and drop it on one of VS2005 IDE toolbars. You will see the Macro Name on the ToolBar –
  13. Do not Close the Customize Popup window --
  14. Right Click the Macro Name on the ToolBar
  15. Select Default Style – This will remove the Macro Name on the ToolBar, resulting in a small Rectangle on the ToolBar
  16. Right Click the Small Rectangle
  17. Select ChangeButtonImage
  18. Select one of the images, for example, the HourGlass. You will see the Image on the toolbar.
  19. Close the Customize PopUp
  20. To test the macro:
    1. Select one of the projects in your solution
    2. Select the CollapseAll Button on the ToolBar
    3. Observe the Solution Explorer will collapse all and will expand the project you have selected.

and that's it. Enjoy!

Del.icio.usDigg It!StumbleUpon

Tags:

Caprica

by Garrett 28. February 2010 09:59

Caprica is the latest installment in the Battlestar Galactica series (which originally aired in the late 70s, and which I used to watch as a young boy with my father), and is, in my opinion, one of the best new shows to hit the cable in years. 

I've been a science fiction fan for decades now (scary how fast time flies) growing up with the original Doctor Who, Battlestar Galactica, and Buck Rogers in the 25th Century shows, and I can honestly say that the new Caprica series is simply awesome.  If you watched the premier episode and weren't too impressed, I say give it another chance.  I too was a bit confused for about the first half of the first show.  I sat there for around an hour wondering what the heck I was getting myself involved in.  Thinking to myself, "this isn't science fiction", but then it started to click.  I began making the connections with the new and the old.  And now, after watching the fifth episode, "There is Another Sky", I am eagerly awaiting next week's episode to see what surprises will be revealed next.

Simply Awesome.

- Garrett

 

Del.icio.usDigg It!StumbleUpon

Tags:

BlogEngine.NET

by Garrett 23. February 2010 07:01

As you can see by the footer, this blog is powered by BlogEngine.NET.  Why BlogEngine.NET and not a free blog host like blogspot.com or wordpress.com?  Well, I'm an application developer so naturally I like to get my hands dirty with code whenever possible. 

BlogEngine.NET is generally highly recommended by those who have used it, and I offer the same recommendation.  I assure you that any engine such as this is not for the uninitiated in programming, but I am quite certain that a web-programmer with experience in any language would be able to implement and customize BlogEngine.NET in a reasonable amount of time.  In fact, I just finished helping my 11-year-old son (he's a beginning programmer & he did most of the work himself) add a blog to his website.

Tip of the week:

If you receive a javascript error indicating that 'BlogEngine' is undefined:

Delete the first "comment" line from blog.js [// global object] and all should be fine.

 Garrett

 

Del.icio.usDigg It!StumbleUpon

Tags:

Welcome to BZB Consulting

by Garrett 22. February 2010 02:29

Welcome to my new blog.  I am a professional developer by trade, and I truly enjoy helping people, so please check back often for (hopefully) helpful hints and tips & tricks.

Garrett

Del.icio.usDigg It!StumbleUpon

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by BZB Consulting