Category: Code

Welcome to Git (what I learned)

Or: How do I use Git (bitbucket, etc.) – and what do these new terms mean.

I come from a background of using source code control and versioning. I originally started with Visual SourceSafe long ago. I’ve since used other tools, but predominantly using the “library method” and Microsoft tools (Team Foundation Server or TFS).

My current role… has me using git (well, bitbucket to be specific). My last role had me using that as well… but they had a different workflow then I do now.

So, I’m trying to wrap my head around the new terminology.

I’m going to document some of the “new terms” and map them to what I understand them to mean. I’ll include some links to where I did some of my research to come up with this “map”.

  • Remote – The source code living out on the server.
  • Local – your copy of the source code on your local working space.
  • Fetch – Get the latest version of the code from the remote.
  • Checkout – Make the branch the “Active” one. This means all future commits happen to this branch.
    • If you have the project open in Visual Studio when you checkout a branch, VS will usually prompt you to reload the project.

I’ll post/update more as I find new stuff.

SQL Server – Aliasing an Instance

As you may know… I’m a software developer. As with most developers, I want things to work… with minimal intervention.

So, when I started a recent contract (.NET Core Web development), they were using a Git repository… I grabbed the latest, restored the DB backup to my local “full install” of SQL Server…

AND BAM! It didn’t work. Why? The current .config files all pointed to a .\SQLExpress DB. Yes… that’s a named instanced on localhost.

Well, I didn’t want to reinstall SQL Server (which is the only way to change the Instance name). And… I didn’t want to have to edit several .config files each time I pulled the latest changes. And for various reasons, the client didn’t want to switch over to using a “connections.config” file to remove the connection strings from the web.configs. (That would have been best, since I could then just git ignore the connections file, and continue working.)

After a bunch of searching, I finally found someone else who had done what I wanted.

Here is a link to the article “How to Configure a SQL Server Alias for a Named Instance on a Development Machine“. For me, I had to make sure I did both 32 bit and 64 bit aliasing.

TADA! I can now leave the .config files alone, and my local install of the DB (that uses the MSSQLServer instance naming) happily works with a connection string pointing at .\SQLExpress!

Help! The indentation on my bullet points are wrong!

I was recently asked to help someone with some HTML. They said that the bullet points were indenting wrong.

If you look at the Results tab below first, you’ll see the difference. The top is what they had, the bottom is what they wanted.

My first thought, was that we’d need to adjust the CSS and fix/change the styling on the UL tag.

Then I saw the HTML. It was a simple change. Use proper HTML elements instead of P tags with special HTML entities and styling.

VOILA! Easy fix.

Learning SQL – A New Resource

I use SQL all the time at work. I’m a web developer (mostly using the IIS, ASP.Net and MS SQL tool chain).

Anytime I can learn some new SQL tricks or logic, I’m happy (well, actually, anytime I can learn anything, I’m happy… but that another post for another day).

I recently found out that Khan Academy has release a new SQL course.

It’s an expansion on their “Hour of SQL” they did back in December of 2014.

Enjoy!

Ektron upgrade from 8.6.1 to 9.1 “Reference.svcmap” error

I recently upgraded Ektron from v8.6.1 to v9.1 SP1. After the upgrade when I tried to view the website, or run the project in Visual Studio I got the following error:

Parser Error Message: Reference.svcmap: Could not load file or assembly 'Ektron.Cms.Contracts, Version=8.6.1.xx, Culture=neutral, PublicKeyToken=559a2c4fa21e63be' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

After much headache and many long emails back and forth with Ektron Support, I finally found an article that got me headed in the right direction.

Follow the link above for screenshots and details.

The basics are:

  1. Edit your Web Reference.
  2. Go into the Advanced tab.
  3. Clear the “Reuse types in referenced assemblies” checkbox and OK.

Converting to a specific timezone inside SSRS

In Microsoft Report Studio (SSRS), we needed to convert to a specific timezone, instead of the more common “Convert to Local Timezone”.

Here is how to do that.

First you MUST include a reference to System.Core.

Then, put this into an expression. The Fields!SomeDate.Value is my date field in SSRS.

'MUST ADD REFERENCE to System.Core

=System.TimeZoneInfo.ConvertTimeFromUtc(Fields!SomeDate.Value, System.TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time") )

VOILA! It now converts from the UTC date, to the Eastern Standard Time. There are many time zones you can choose from.

Are you running in the IDE?

Two methods, one for .NET (Visual Basic, but easily adjusted for C#) and the other for VB Classic (VB 5 and 6)

To check and see if the .NET code is running from the IDE:

More specifically, the .NET method checks to see if there is a debugger attached.  It is possible to attach a debugger to a compiled exe, so this would return True.

<code>
  If System.Diagnostics.Debugger.IsAttached Then
    ‘This is a way to see if we are running in the IDE. 

  End If
</code>

And, if you’re using VB Classic, you can use this:

<code>
‘Since Debug commands are compiled OUT, this will never return an error
‘when the code is compiled.
Private Function IsDebugMode as Boolean
  On Error Resume Next
  Debug.Assert 1/0
  IsDebugMode = (Err.Number <> 0)
  On Error Goto 0
End Function
</code>

Powered by WordPress & Theme by Anders Norén